using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace CocaCola_Inventory_System.Forms
{
    public partial class Log : Form
    {
        retrieve r;
        DataTable logs;
        public Log()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            retrieve();
        }

        private void Log_Load(object sender, EventArgs e)
        {
            if (((CocaCola_Inventory_System.Forms.Container)this.MdiParent).security < 2)
            {
                MessageBox.Show("Not Authorized");
                return;
            }
            r = new retrieve(((CocaCola_Inventory_System.Forms.Container)this.MdiParent).con);
            logs = new DataTable();
            retrieve();
        }

        public void retrieve()
        {
            logs = r.getlog();
            dataGridView1.DataSource = logs;
            dataGridView1.Sort(dataGridView1.Columns[2], ListSortDirection.Descending);
            
        }

        private void refreshToolStripMenuItem_Click(object sender, EventArgs e)
        {
            retrieve();
        }
    }
}